package service.impl;

import dao.HelloDao;
import dao.impl.HelloDaoImpl;
import factory.BeanFactory;
import service.HelloService;

import java.util.Arrays;
import java.util.List;

public class HelloServiceImpl implements HelloService {

    private HelloDao helloDao = (HelloDao) BeanFactory.getHelloDao("helloDao");

    public HelloServiceImpl(){

        //测试单例模式是否成功

        for(int i = 1;i<=10;i++){
            System.out.println((HelloDao) BeanFactory.getHelloDao("helloDao"));
        }

    }

    @Override
    public List<String> findAll() {
        return this.helloDao.findAll();
    }
}
